<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.5"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>SWM34S_LVGL7.11_SWMUI: C:/Users/DELL/Desktop/Commit/lvgl/SWM34S_LVGL7.11_SWMUI_20230515/APP/BSP/dev_rtc.c 源文件</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">SWM34S_LVGL7.11_SWMUI<span id="projectnumber">&#160;V7.9</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.9.5 -->
<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_0ca16891106f5a3e9ad635a0d6c5f98f.html">APP</a></li><li class="navelem"><a class="el" href="dir_4ca18d753a70f6eada20fde478bd3fc8.html">BSP</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle"><div class="title">dev_rtc.c</div></div>
</div><!--header-->
<div class="contents">
<a href="dev__rtc_8c.html">浏览该文件的文档.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno">    1</span> </div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno">   22</span><span class="preprocessor">#include &quot;<a class="code" href="dev__rtc_8h.html">dev_rtc.h</a>&quot;</span></div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno">   23</span> </div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"><a class="line" href="dev__rtc_8c.html#a93027054bad6b770d239d991f4cd2236">   24</a></span><span class="keyword">volatile</span> RTC_DateTime <a class="code hl_variable" href="dev__rtc_8c.html#a93027054bad6b770d239d991f4cd2236">IRQ_RTC_Time</a>; </div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"><a class="line" href="dev__rtc_8c.html#aedd83f0c9b0f418ce1097807c1b5d186">   31</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="dev__rtc_8c.html#aedd83f0c9b0f418ce1097807c1b5d186">rtc_init</a>(RTC_DateTime *init_time)</div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno">   32</span>{</div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno">   33</span>    <span class="keywordflow">if</span> (init_time == NULL)</div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno">   34</span>        <span class="keywordflow">return</span>; <span class="comment">// assert</span></div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno">   35</span> </div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno">   36</span>    RTC_InitStructure RTC_initStruct;</div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno">   37</span>    RTC_initStruct.clksrc = RTC_CLKSRC_LRC32K; <span class="comment">/* RTC_CLKSRC_LRC32K / RTC_CLKSRC_XTAL32K */</span></div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno">   38</span>    RTC_initStruct.Year = init_time-&gt;Year;</div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno">   39</span>    RTC_initStruct.Month = init_time-&gt;Month;</div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno">   40</span>    RTC_initStruct.Date = init_time-&gt;Date;</div>
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno">   41</span>    RTC_initStruct.Hour = init_time-&gt;Hour;</div>
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno">   42</span>    RTC_initStruct.Minute = init_time-&gt;Minute;</div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno">   43</span>    RTC_initStruct.Second = init_time-&gt;Second;</div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno">   44</span>    RTC_initStruct.SecondIEn = 1;</div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno">   45</span>    RTC_initStruct.MinuteIEn = 0;</div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno">   46</span>    RTC_Init(RTC, &amp;RTC_initStruct);</div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno">   47</span>    RTC_Start(RTC);</div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno">   48</span>    </div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno">   49</span>    <span class="comment">/*</span></div>
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno">   50</span><span class="comment">    RTC_AlarmStructure alarmStruct;</span></div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno">   51</span><span class="comment">    alarmStruct.Days = RTC_SUN | RTC_MON | RTC_TUE | RTC_WED | RTC_THU | RTC_FRI | RTC_SAT;</span></div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno">   52</span><span class="comment">    alarmStruct.Hour = 10;</span></div>
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno">   53</span><span class="comment">    alarmStruct.Minute = 5;</span></div>
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno">   54</span><span class="comment">    alarmStruct.Second = 8;</span></div>
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno">   55</span><span class="comment">    alarmStruct.AlarmIEn = 1;</span></div>
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno">   56</span><span class="comment"></span> </div>
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno">   57</span><span class="comment">    RTC_AlarmSetup(RTC, &amp;alarmStruct);</span></div>
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno">   58</span><span class="comment">    */</span></div>
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno">   59</span>}</div>
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno">   60</span> </div>
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"><a class="line" href="dev__rtc_8c.html#a15ec0860914516da8aad277403398fc4">   64</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="dev__rtc_8c.html#a15ec0860914516da8aad277403398fc4">isr_rtc</a>(<span class="keywordtype">void</span>)</div>
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno">   65</span>{</div>
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno">   66</span>    <span class="keywordflow">if</span> (RTC_INTStat(RTC, RTC_IT_SECOND))</div>
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno">   67</span>    {</div>
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno">   68</span>        RTC_INTClr(RTC, RTC_IT_SECOND);</div>
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno">   69</span> </div>
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno">   70</span>        RTC_GetDateTime(RTC, (RTC_DateTime *)&amp;<a class="code hl_variable" href="dev__rtc_8c.html#a93027054bad6b770d239d991f4cd2236">IRQ_RTC_Time</a>);</div>
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno">   71</span>    }</div>
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno">   72</span> </div>
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno">   73</span>    <span class="keywordflow">if</span> (RTC_INTStat(RTC, RTC_IT_ALARM))</div>
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno">   74</span>    {</div>
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno">   75</span>        RTC_INTClr(RTC, RTC_IT_ALARM);</div>
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno">   76</span> </div>
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno">   77</span>        <span class="comment">/*</span></div>
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno">   78</span><span class="comment">        RTC_AlarmStructure alarmStruct;</span></div>
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno">   79</span><span class="comment">        alarmStruct.Days = RTC_SUN | RTC_MON | RTC_TUE | RTC_WED | RTC_THU | RTC_FRI | RTC_SAT;</span></div>
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno">   80</span><span class="comment">        alarmStruct.Hour = 10;</span></div>
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno">   81</span><span class="comment">        alarmStruct.Minute = 5;</span></div>
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno">   82</span><span class="comment">        alarmStruct.Second = 8;</span></div>
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno">   83</span><span class="comment">        alarmStruct.AlarmIEn = 1;</span></div>
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno">   84</span><span class="comment"></span> </div>
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno">   85</span><span class="comment">        RTC_AlarmSetup(RTC, &amp;alarmStruct);</span></div>
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno">   86</span><span class="comment">        */</span></div>
<div class="line"><a id="l00087" name="l00087"></a><span class="lineno">   87</span>    }</div>
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno">   88</span>}</div>
<div class="ttc" id="adev__rtc_8c_html_a15ec0860914516da8aad277403398fc4"><div class="ttname"><a href="dev__rtc_8c.html#a15ec0860914516da8aad277403398fc4">isr_rtc</a></div><div class="ttdeci">void isr_rtc(void)</div><div class="ttdoc">RTC ISR Callback</div><div class="ttdef"><b>Definition:</b> <a href="dev__rtc_8c_source.html#l00064">dev_rtc.c:64</a></div></div>
<div class="ttc" id="adev__rtc_8c_html_a93027054bad6b770d239d991f4cd2236"><div class="ttname"><a href="dev__rtc_8c.html#a93027054bad6b770d239d991f4cd2236">IRQ_RTC_Time</a></div><div class="ttdeci">volatile RTC_DateTime IRQ_RTC_Time</div><div class="ttdoc">RTC 时间</div><div class="ttdef"><b>Definition:</b> <a href="dev__rtc_8c_source.html#l00024">dev_rtc.c:24</a></div></div>
<div class="ttc" id="adev__rtc_8c_html_aedd83f0c9b0f418ce1097807c1b5d186"><div class="ttname"><a href="dev__rtc_8c.html#aedd83f0c9b0f418ce1097807c1b5d186">rtc_init</a></div><div class="ttdeci">void rtc_init(RTC_DateTime *init_time)</div><div class="ttdoc">RTC 初始化</div><div class="ttdef"><b>Definition:</b> <a href="dev__rtc_8c_source.html#l00031">dev_rtc.c:31</a></div></div>
<div class="ttc" id="adev__rtc_8h_html"><div class="ttname"><a href="dev__rtc_8h.html">dev_rtc.h</a></div><div class="ttdoc">RTC 在线计时(No VBAT)</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
制作者&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.5
</small></address>
</body>
</html>
